<?#//v.3.1.1
#///////////////////////////////////////////////////////
#//  COPYRIGHT 2004 Phpauction.org ALL RIGHTS RESERVED//
#///////////////////////////////////////////////////////

require('../includes/config.inc.php');
include "loggedin.inc.php";
#//
if($_POST[action] == "update"  && phpa_securepost($_POST))
{
	if(empty($_POST[sizetype]))
	{
		$ERR = $ERR_047;
		$SETTINGS = $_POST;
	}
	elseif($_POST[sizetype] == 'fix' &&
	(empty($_POST[width] ) || empty($_POST[height])))
	{
		$ERR = $ERR_047;
		$SETTINGS = $_POST;
	}
	elseif($_POST[sizetype] == 'fix' &&
	(!ereg("^[0-9]+$",$_POST[width]) || !ereg("^[0-9]+$",$_POST[height])))
	{
		$ERR = $MSG__0020;
		$SETTINGS = $_POST;
	}
	else
	{
		#// Update database
		$query = "update PHPAUCTIONXL_bannerssettings
					  SET
					  sizetype='$_POST[sizetype]',
					  width=".intval($_POST[width]).",
					  height=".intval($_POST[height]);
		$res = @mysql_query($query);
		if(!$res)
		{
			print "Error: $query<BR>".mysql_error();
			exit;
		}
		else
		{
			$ERR = $MSG_600;
			$SETTINGS = $_POST;
		}
	}
}
else
{
	#//
	$query = "SELECT * FROM PHPAUCTIONXL_bannerssettings";
	$res = @mysql_query($query);
	if(!$res)
	{
		print "Error: $query<BR>".mysql_error();
		exit;
	}
	elseif(mysql_num_rows($res) > 0)
	{
		$SETTINGS = mysql_fetch_array($res);
	}
}

?>
<HTML>
<HEAD>
<link rel='stylesheet' type='text/css' href='style.css' />
<link href="css/main.css" rel="stylesheet" type="text/css">
</HEAD>
<body bgcolor="#FFFFFF" text="#000000" link="#0066FF" vlink="#666666" alink="#000066" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="titulo">
        <tr> 
          <td class="icono"><img src="images/ad_icon2.gif" width="22" height="22" ></td>
          <td class="breadcrumbs"><p><span><?=$MSG_25_0011?></span>&nbsp;&gt;&gt;&nbsp;<?=$MSG__0013?></p></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td align="center" valign="middle">&nbsp;</td>
  </tr>
    <tr> 
    <td align="center" valign="middle">
<TABLE BORDER=0 WIDTH=100% CELLPADDING=0 CELLSPACING=0 BGCOLOR="#FFFFFF">
<TR>
<TD align="center">
	<BR>
	<FORM NAME=conf ACTION=<?=basename($_SERVER['PHP_SELF'])?> METHOD=POST>
		<TABLE WIDTH="95%" BORDER="0" CELLSPACING="0" CELLPADDING="0" class="base" style="border:1px solid #ccc;">
			<TR>
				<TD ALIGN=CENTER class=title>
					<p><? print $MSG__0013; ?></p>
					</B></TD>
			</TR>
			<TR>
				<TD>

                <TABLE WIDTH=100% ALIGN="CENTER" CELLPADDING=0 cellspacing="0" BGCOLOR="#FFFFFF">
                  <?
                  if(!empty($ERR))
                  {
						?>
                  <TR>
                    <TD class=error COLSPAN="2" >
                      <p><?=$ERR?></p>
                     </TD>
                  </TR>
                  <?
                  }
						?>
                  <TR VALIGN="TOP">
                    <TD COLSPAN="2" class="lineV">
                      <p><? print $MSG__0014; ?></p>
                      </TD>
                  </TR>
                  <TR VALIGN="TOP" BGCOLOR="#dddddd">
                    <TD WIDTH="73" HEIGHT="22">
					<p>
                      <INPUT TYPE="radio" NAME="sizetype" VALUE="any"
								<? if($SETTINGS[sizetype] == 'any') print " CHECKED";?>
								></p>
                      </TD>
                    <TD HEIGHT="22" WIDTH="559">
                      <p><?=$MSG__0015?></p>
                      </TD>
                  </TR>
                  <TR VALIGN="TOP">
                    <TD WIDTH="73" HEIGHT="22" BGCOLOR="#eeeeee">
					<p>
                      <INPUT TYPE="radio" NAME="sizetype" VALUE="fix"
								<? if($SETTINGS[sizetype] == 'fix') print " CHECKED";?>
								></p>
                      </TD>
                    <TD HEIGHT="22" WIDTH="559" BGCOLOR="#eeeeee">
                     <p> <?=$MSG__0016?></p>
                      </TD>
                  </TR>
                  <TR VALIGN="TOP">
                    <TD WIDTH="73" HEIGHT="22" BGCOLOR="#eeeeee">
                      <p><?=$MSG__0017?></p>
                      </TD>
                    <TD WIDTH="559" HEIGHT="22" BGCOLOR="#eeeeee">
                      <INPUT TYPE=text NAME=width VALUE="<?=$SETTINGS[width]?>">
					  <?=$MSG__0019?>
                      </TD>
                  </TR>
                  <TR VALIGN="TOP">
                    <TD WIDTH="73" HEIGHT="22" BGCOLOR="#eeeeee">
                      <p><?=$MSG__0018?></p>
                      </TD>
                    <TD HEIGHT="22" WIDTH="559" BGCOLOR="#eeeeee">
                      <INPUT TYPE=text NAME=height VALUE="<?=$SETTINGS[height]?>">
					  <?=$MSG__0019?>
                      </TD>
                  </TR>
                  <TR>
                    <TD WIDTH="73">&nbsp; </TD>
                    <TD WIDTH="559">
                      <INPUT TYPE="hidden" NAME="action" VALUE="update" /> <INPUT TYPE="hidden" NAME="security" VALUE="<?php echo $_SESSION['security'];?>" />
                      <INPUT TYPE="hidden" NAME="id" VALUE="<?=$id?>">
                      <INPUT TYPE="submit" NAME="act" VALUE="<? print $MSG_530; ?>" class="action">
                    </TD>
                  </TR>
                  <TR>
                    <TD COLSPAN="2"> </TD>
                  </TR>
                </TABLE>
				</TD>
			</TR>
		</TABLE>
		</FORM>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>